package com.itqf.Controller;

import com.github.pagehelper.PageInfo;
import com.itqf.Service.Topic.TopicService;
import com.itqf.Util.SearchCount;
import com.itqf.Util.myPageInfo;
import com.itqf.entity.Topic;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


@Controller
public class HotsearchController {
    @Resource
    private TopicService topicService;
    //热门搜索的搜索内容

    @RequestMapping(value = "/hotsearch",method = RequestMethod.POST)
    @ResponseBody
    public PageInfo<Topic> gettopics(@RequestParam(defaultValue = "1") int pageindex, String searchname, HttpServletRequest request)
    {
        PageInfo<Topic> findbysearchname = topicService.findbysearchname(pageindex, myPageInfo.PAGESIZE, searchname);

        return findbysearchname;
    }
   /* //热门搜索回显数据
    @RequestMapping(value = "/hotsearchdata",method = RequestMethod.POST)
    @ResponseBody
    public Object gethostsearchdata(HttpServletRequest request)
    {
        HttpSession session = request.getSession();
        Map map=(Map)session.getAttribute("map");
        Collection values = map.values();

         return values;
    }*/
}
